1
2
3
4
5
6
7 package ca.uhn.cache;
8
9 import java.util.Iterator;
10
11 /***
12 * Represents a set of <code>IDataItem</code> s that correspond to a query.
13 *
14 * @author <a href="mailto:bryan.tripp@uhn.on.ca">Bryan Tripp </a>
15 * @version $Revision: 1.1 $ updated on $Date: 2005/01/24 22:52:08 $ by $Author:
16 * btripp $
17 */
18 public interface IQueryResult {
19
20 /***
21 * Adds a new item to the data set.
22 *
23 * @param theItem
24 * the <code>IDataItem</code> to add
25 *
26 * @precondition theItem != null
27 */
28 public void add( IDataItem theItem );
29
30 /***
31 * @return an Iterator over all the <code>IDataItem</code> s in this data
32 * set
33 */
34 public Iterator iterator();
35
36 /***
37 * Appends the specified query result to the end of this query result.
38 *
39 * <p>
40 * If the argument query result is empty, the this query result is returned.
41 * Otherwise a new <code>IQueryResult</code> is created, containing the
42 * query result items of this query result and the ones of the argument one.
43 * </p>
44 *
45 * @param theQueryResult
46 * The query result to be appended.
47 *
48 * @return A query result that contains the query result items of this query
49 * result and the ones of the argument query result.
50 */
51 public IQueryResult append( IQueryResult theQueryResult );
52
53 /***
54 * @return <tt>true</tt> if this query result contains no data items
55 */
56 public boolean isEmpty();
57
58 /***
59 * Returns the number of elements in this query result. If this query result
60 * contains more than <tt>Integer.MAX_VALUE</tt> data items, returns
61 * <tt>Integer.MAX_VALUE</tt>.
62 *
63 * @return the number of elements in this query result.
64 */
65 public int size();
66
67 }